package java_test;

import java.util.ArrayList;
import java.util.Scanner;

public class test {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int counts=scanner.nextInt();
		scanner.nextLine();
		ArrayList<String> arrayList=new ArrayList<>();
		while(counts-->0){
			String string=scanner.nextLine();
			int left=0;
			int right=0;
			boolean flag=false;
			
			for(int i=0;i<string.length();i++){
				if(string.charAt(i)=='(')
					left++;
				else
					right++;
				if(right-left>1){
					flag=true;
				}
			}
			if(left!=right){
				arrayList.add("No");
				continue;
			}
			if(string.equals("()"))
				flag=true;
			if(flag==false){
				arrayList.add("Yes");
			}else
				arrayList.add("No");
		}
		for(int i=0;i<arrayList.size();i++){
			System.out.println(arrayList.get(i));
		}
		scanner.close();
	}
}
